package com.shareach.redis;

import java.util.Set;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisShardInfo;

public class NewJedis extends Jedis{

	public NewJedis(String host){
        super(host);
        client = null;
        client = new NewClient(host);
    }

    public NewJedis(String host, int port){
        super(host, port);
        client = null;
        client = new NewClient(host, port);
    }

    public NewJedis(String host, int port, int timeout){
        super(host, port, timeout);
        client = null;
        client = new NewClient(host, port);
        client.setTimeout(timeout);
    }

    public NewJedis(JedisShardInfo shardInfo){
        super(shardInfo);
        client = null;
        client = new NewClient(shardInfo.getHost(), shardInfo.getPort());
        client.setTimeout(shardInfo.getTimeout());
        client.setPassword(shardInfo.getPassword());
    }

    public Long srem(String key, Set<String> members){
        checkIsInMulti();
        try {
			client.srem(key, members);
		} catch (Exception e) {
			e.printStackTrace();
		}
        return client.getIntegerReply();
    }
    
    private NewClient client;
}
